﻿<Page x:Class="Songhay.Wpf.Mvvm.Views.ApplicationMessagePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    mc:Ignorable="d"
    xmlns:vm="clr-namespace:Songhay.Wpf.Mvvm.ViewModels"
    d:DesignHeight="300" d:DesignWidth="512"
    Title="{Binding PageTitle}">
    <Page.Resources>
        <vm:ApplicationMessagePageViewModel x:Key="ApplicationMessagePageViewModelDataSource" d:IsDataSource="True" />
        <DataTemplate x:Key="PageTemplate">
            <StackPanel Background="#99000000" VerticalAlignment="Center">
                <TextBlock
                    FontSize="24"
                    FontFamily="Consolas"
                    HorizontalAlignment="Stretch"
                    Margin="24"
                    Text="{Binding Path=PageTitle}"
                    TextAlignment="Center" />
                <TextBlock
                    FontSize="18"
                    FontFamily="Consolas"
                    HorizontalAlignment="Stretch"
                    Margin="0,0,0,24"
                    Text="{Binding Path=ApplicationMessage}"
                    TextAlignment="Center" />
            </StackPanel>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding Path=IsErrorMessage}" Value="False">
                    <Setter Property="TextBlock.Foreground" Value="White" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=IsErrorMessage}" Value="True">
                    <Setter Property="TextBlock.Foreground" Value="Red" />
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    </Page.Resources>
    <Page.DataContext>
        <Binding Mode="OneWay" Source="{StaticResource ApplicationMessagePageViewModelDataSource}" />
    </Page.DataContext>
    <ContentControl
        Content="{Binding}"
        ContentTemplate="{StaticResource PageTemplate}" />
</Page>
